package member.domain;

public class Member {
	private String id;
	private String name;
	private String email;
	private int mileage;
	private boolean marrage;
	private Address address;

	//생성자
	public Member(){}

	public Member(String id, String name, String email, int mileage,
			boolean marrage, Address address) {
		super();
		this.id = id;
		this.name = name;
		this.email = email;
		this.mileage = mileage;
		this.marrage = marrage;
		this.address = address;
	}

	public Member(String id, String name, String email, int mileage,
			boolean marrage) {
		super();
		this.id = id;
		this.name = name;
		this.email = email;
		this.mileage = mileage;
		this.marrage = marrage;
	}
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public int getMileage() {
		return mileage;
	}

	public void setMileage(int mileage) {
		this.mileage = mileage;
	}

	public boolean isMarrage() {
		return marrage;
	}

	public void setMarrage(boolean marrage) {
		this.marrage = marrage;
	}

	public Address getAddress() {
		return address;
	}

	public void setAddress(Address address) {
		this.address = address;
	}

	@Override
	public String toString() {
		return "Member [id=" + id + ", name=" + name + ", email=" + email
				+ ", mileage=" + mileage + ", marrage=" + marrage
				+ ", address=" + address + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((address == null) ? 0 : address.hashCode());
		result = prime * result + ((email == null) ? 0 : email.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + (marrage ? 1231 : 1237);
		result = prime * result + mileage;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Member other = (Member) obj;
		if (address == null) {
			if (other.address != null)
				return false;
		} else if (!address.equals(other.address))
			return false;
		if (email == null) {
			if (other.email != null)
				return false;
		} else if (!email.equals(other.email))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (marrage != other.marrage)
			return false;
		if (mileage != other.mileage)
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}
	
}
